package com.ffz.servicebase.handler;

import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import org.apache.ibatis.reflection.MetaObject;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * @ClassName : MyMetaObjectHandler.java
 * @Description : //
 * @Author fengfazheng
 * @Date 2020-11-06 18:04
 * @Version : 1.0
 */
@Component
public class MyMetaObjectHandler implements MetaObjectHandler {
    //属性名称
    @Override
    public void insertFill(MetaObject metaObject) {
        this.setFieldValByName("gmtCreate", new Date(), metaObject);
        this.setFieldValByName("gmtModified", new Date(), metaObject);
    }

    @Override
    public void updateFill(MetaObject metaObject) {
        this.setFieldValByName("gmtModified", new Date(), metaObject);
    }
}
